package com.loser.module.base.mq;

import cn.hutool.core.util.StrUtil;
import com.loser.utils.trace.MDCUtil;
import com.loser.utils.trace.TraceUtil;
import lombok.Data;

import java.io.Serializable;

@Data
public class BaseMqMsg implements Serializable {

    private static final long serialVersionUID = 7581339796446717946L;

    protected String traceId;

    public String getTraceId() {
        return traceId;
    }

    public BaseMqMsg() {
        String id = MDCUtil.getTraceId();
        if (StrUtil.isEmpty(id)) {
            id = TraceUtil.getTraceId();
        }
        traceId = id;
    }
}
